home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.uib.no!usenet
- From: magnus@due.ii.uib.no (Magnus Y Alvestad)
- Newsgroups: comp.lang.misc,comp.lang.c
- Subject: Re: GOTO controversy
- Date: 08 Mar 1996 20:35:37 +0100
- Organization: Department of Informatics
- Message-ID: <evlolbgyye.fsf@due.ii.uib.no>
- References: <rcshlds.1.000A6705@mailserv.mta.ca> <Dn8pJ8.nqs@emi.net>
- <4grt4e$8fg@goanna.cs.rmit.EDU.AU> <4hl8mt$4po@newshost.cyberramp.net>
- <DnwCxp.84C@clw.cs.man.ac.uk>
- Reply-To: magnus@ii.uib.no
- NNTP-Posting-Host: due.ii.uib.no
- X-Newsreader: September Gnus v0.45/Emacs 19.30
-
- [Charles]
-
- | Well that is what I thougut when I first saw the example, and
- | I was about to dash off an article like you have done. But
- | then I looked again and saw *exactly* what it was doing.
-
- | So if you believe there is a better way, please can we see
- | it?
-
- This seems to do the same thing to me, but I may have misunderstood
- the original code.
-
- HEV hev1, hev2, hev3; /* Event semaphores */
- HMTX hmtx; /* Mutex semaphore */
- void *ptr;
-
- if (DosCreateEventSem(0, &hev1, 0, FALSE))
- { if (DosCreateEventSem(0, &hev2, 0, FALSE))
- { if (DosCreateEventSem(0, &hev3, 0, FALSE))
- { if (DosCreateMutexSem(0, &hmtx, 0, FALSE))
- { if ((ptr = malloc(SOME_SIZE)) == NULL)
- return TRUE; /* We did okay */
- DosCloseMutexSem(hmtx); }
- DosCloseEventSem(hev3); }
- DosCloseEventSem(hev2); }
- DosCloseEventSem(hev1); }
- return FALSE;
-
- -Magnus
-